// 聊天列表组件
<template>
  <div class="msglist">
    <div>
        <div v-for="sideList in chatList" :class="{ active: sideList.userId === selectId }" v-on:click="CHANGE_SELECT_ID(sideList.userId)">
            <!-- <div class="list-left">
            	<img class="avatar"  width="42" height="42">
            </div> -->
            	<p class="name">{{sideList.room.storeName}}</p>
                <!-- <span class="time">{{sideList.msg[sideList.msg.length-1].date|time}}</span> -->
            	<p class="lastmsg">{{sideList.msg[sideList.msg.length-1].content}}</p>
        </div>
    </div>
  </div>
</template>

<script>
import store from '../store'
import { mapState,mapMutations } from 'vuex'

export default {
  name: 'ChatList',
  methods:{
		...mapMutations([
			'CHANGE_SELECT_ID'
		])
	},
	computed:{
		...mapState([
			'chatList',
			'selectId'
		])
	}
}
</script>
<style scoped lang="less">
.msglist{
	width: 150px;
	.sideList{
		list-style: none;
		padding-left: 10px;
	}
	.active{
		background-color: aliceblue;
	}
  .sessionlist{
    display: flex;
		font-size: 10;
  }
}
</style>